/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.mybatis.model;

import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.ListModel;

/**
 *
 * @author ProjetGWTPhp
 */
public class ListModelCheck extends AbstractListModel implements ListModel {

    private CheckItem selectedColumn;
    private List<CheckItem> listColumn;

    public ListModelCheck(List<CheckItem> listColumn) {
        this.listColumn = listColumn;
    }

    public void addItem(CheckItem item) {
        this.listColumn.add(item);
        super.fireContentsChanged(this, -1, -1);
    }

        public void deleteAll() {
        
        this.listColumn= new java.util.ArrayList();
        super.fireContentsChanged(this, -1, -1);
    }
    
    
    public void deleteItem(CheckItem item) {
        //this.listColumn.add(item);
        this.listColumn.remove(item);
        super.fireContentsChanged(this, -1, -1);
    }

    @Override
    public int getSize() {
        return this.listColumn.size();
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Object getElementAt(int index) {
        return this.listColumn.get(index);

        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    public List<CheckItem> getAllElements(){
    return this.listColumn;
    }
}
